package com.example.mybatisplusproject;

import com.example.mybatisplusproject.entity.*;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import org.springframework.util.Assert;

import java.util.List;

public class App {

    public static void main(String[] args) throws Exception {
        Assert.notNull(null, "haha");
        
        ObjectMapper objectMapper = new ObjectMapper();
        List<Shape> shapes = Lists.newArrayList(
                Rectangle.of(10, 20),
                Circle.of(100),
                Square.of(50)
        );

        // serializing
        String jsonString = objectMapper.writeValueAsString(Containers.of(shapes));
        System.out.println("jsonString=" + jsonString);

        // deserializing
        Containers containers = objectMapper.readValue(jsonString, Containers.class);
        System.out.println("containers=" + containers);
    }

}